package cn.itsource.romate.fallback;

import cn.itsource.pojo.bo.RuleStartBo;
import cn.itsource.pojo.dto.RuleStartDto;
import cn.itsource.pojo.dto.SharingDto;
import cn.itsource.pojo.vo.SharingVo;
import cn.itsource.result.R;
import cn.itsource.romate.api.RuleApi;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 📖：beishan
 * 🗓️：2024/4/10 18:19
 * =====================
 */
@Component
public class RuleFallBackFactory implements FallbackFactory<RuleApi> {
    @Override
    public RuleApi create(Throwable cause) {
        return new RuleApi() {
            @Override
            public RuleStartBo ruleStartAdvance(RuleStartDto ruleStartDto) {
                cause.printStackTrace();
                RuleStartBo RuleStartBo = null;
                return RuleStartBo;
            }

            @Override
            public R ruleWait(Long moreData) {
                return R.error("等时计价失败");
            }

            @Override
            public R<SharingVo> sharing(SharingDto sharingDto) {
                cause.printStackTrace();
                return R.error("平台计价失败");
            }

//            @Override
//            public R ruleStartPay(RuleStartDto ruleStartDto) {
//                return R.error("实付计价出错了");
//            }
        };
    }
}
